import request from '@/utils/request'

// 查询合同信息列表
export function listContract(query) {
  return request({
    url: '/businessManagement/contract/list',
    method: 'get',
    params: query
  })
}

// 查询合同信息详细
export function getContract(id) {
  return request({
    url: '/businessManagement/contract/' + id,
    method: 'get'
  })
}

// 新增合同信息
export function addContract(data) {
  return request({
    url: '/businessManagement/contract',
    method: 'post',
    data: data
  })
}

// 修改合同信息
export function updateContract(data) {
  return request({
    url: '/businessManagement/contract',
    method: 'put',
    data: data
  })
}

// 删除合同信息
export function delContract(id) {
  return request({
    url: '/businessManagement/contract/' + id,
    method: 'delete'
  })
}

// 审核通过
export function auditYes(id) {
  return request({
    url: '/businessManagement/contract/auditYes/'+id,
    method: 'put',
    
  })
}

// 审核不通过
export function auditNo(id) {
  return request({
    url: '/businessManagement/contract/auditNo/'+id,
    method: 'put',
    
  })
}

// 确认盖章操作
export function sealYes(id) {
  return request({
    url: '/businessManagement/contract/sealYes/'+id,
    method: 'put',
    
  })
}

// 作废合同操作
export function InvalidYes(id) {
  return request({
    url: '/businessManagement/contract/InvalidYes/'+id,
    method: 'put',
    
  })
}

// // 下载合同操作
// export function downloadAnnex(appendix) {
//   return request({
//     url: '/common/download',
//     method: 'get',
//     fileName: appendix
    123456789
//   })
// }

// 下载合同操作
export function downloadAnnex(appendix) {
  return request({
    //ctx+'common/download/resource'+filename.substring(filename.lastIndexOf("/upload"))
    url: 'common/download/resource'+appendix.substring(appendix.lastIndexOf("/upload")),
    method: 'get',
  })
}
